Styles
The style object allows you to specify stylistic modifications for your shape objects. Like shape objects, style objects have properties that you can examine and edit. When you draw a shape, QuickDraw GX examines the properties of the shape's style object and modifies the appearance of the shape as indicated by the values of the style object's properties.Figure 3-24 shows all of the properties of the style object.
Figure 3-24 The style object and its properties
There are four categories of style properties shown in Figure 3-17:
The same style object can be shared by a number of different types of shapes. For example, a line shape, and text shape, and a layout shape can all reference the same style object. When you draw the three shapes, QuickDraw GX
- Common style properties apply to all types of shapes. (These are the owner count and tag list.)
- Geometric style properties apply to geometric shapes. (These are the properties in the left column.)
- Typographic style properties apply to typographic shapes. (These are the properties in the middle column.)
- Layout style properties apply only to layout shapes. (These are the properties in the right column.)
applies the information from the appropriate style properties to each shape.Geometric Styles
Seven properties of the style object apply primarily to geometric shapes. These properties are the geometric style properties. Figure 3-25 lists these properties and shows examples of how they might affect a simple polygon shape.Figure 3-25 Geometric style properties
Here is a description of the geometric style properties:
QuickDraw GX provides functions that allow you to examine and modify
- The pen width property determines the thickness at which QuickDraw GX draws a geometric shape's contours.
- The caps property allows you to specify the shapes to draw at the ends of another shape's contours.
- The join property allows you to specify how to draw a shape's corners.
- The dash property allows you to specify the shape to use to dash the contours of another shape.
- The pattern property allows you to specify the shape to use to pattern the area of another shape.
- The curve error property is used during geometric operations and type conversions to specify how far apart two geometric points must be to be considered separate points.
- The style attributes property allows you to specify pen placement--whether the pen draws to the left, right, or centered on a shape's contours.
each of these properties; for example,GXGetStylePen
,GXSetStylePen
,GXGetStyleCaps
, andGXSetStyleCaps
. You provide a reference to the style object for each of these functions.QuickDraw GX also provides a set of functions that allow you to examine
and modify these properties given a reference to a shape object; for example,GXGetShapePen
,GXSetShapePen
,GXGetShapeCaps
, andGXSetShapeCaps
. If the shape shares its style object, QuickDraw GX makes a copy of the style object before modifying its properties.Bitmap and Picture Styles
Bitmap and picture shapes make much less use of their style objects than do geometric and typographic shapes.The only part of the style object that bitmap shapes use are the flags in the style attributes property that indicate whether a shape should be constrained to integer positions on the coordinate grid. For example, you can constrain the upper-left corner of a bitmap to an integer grid position.
Picture shapes themselves make no use of their style objects. Although you can still examine and modify the properties of a picture's style object, the values of the properties don't affect the way the picture is drawn.
However, each shape in a picture has its own style object. QuickDraw GX does use the information in those style objects when drawing the picture. Addition-
ally, you can specify an overriding style object for each item in a picture. If an item has an overriding style object, QuickDraw GX uses the information in the overriding style, rather than the original style, when drawing that item as part of the picture.Typographic and Layout Styles
Style objects also have properties that apply only to typographic shapes, some of which apply only to layout shapes. Figure 3-26 shows these properties and some examples of how they might affect typographic shapes.Figure 3-26 Typographic style properties
Here is a description of the typographic style properties:
QuickDraw GX provides functions that allow you to examine or modify the value of each of these properties; for example,
- The font property references the font object that contains the default font information for the typographic shape.
- The text face property allows you to programmatically construct typestyles, such as bold or oblique, to apply to a typographic shape.
- The text size property specifies the size in typographic points at which to draw the shape.
- The alignment property allows you to specify that text be left-aligned, right-aligned, aligned anywhere between the two (such as centered), or
fully justified.- The font variations property lists of stylistic variations built into the font that are available for drawing the text of the shape.
- The encoding property indicates the type of character encoding used to represent the text of this shape, as well as its script and language.
- The text attributes property contains a set of flags that allow you to specify how QuickDraw GX alters glyph outlines or chooses metrics for horizontal or vertical text.
GXGetStyleFont
,GXSetStyleFont
,GXGetStyleFace
, andGXSetStyleFace
.Here is a description of the layout style properties:
Figure 3-27 shows some examples of the effects of the layout style run controls property.
- The run controls property controls a variety of formatting and display features.
- The kerning adjustments array property alters the kerning behavior of
pairs of glyphs.- The glyph substitutions array property gives you final control of glyph selection when drawing a layout shape.
- The run-features array property specifies whether to employ various special typographic features.
- The priority justification override property alters the standard justification behavior for groups of glyphs.
- The glyph justification overrides array property alters the standard justification behavior for one or more individual glyphs.
Figure 3-27 Sample effects of run controls
For more information about typographic and layout styles, see Inside Macintosh: QuickDraw GX Typography.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help